
angular.module('theApp.filters', [])

.filter('friends', function() {
    return function(vec, ids, matches, S) {     
        
        var vv = [];
        var ss = {};
        vec.forEach(function(e) {
            ids.forEach(function(id) {                
                x = S.match_key(id, e.id);
                var f = matches[x];
                
                if (f === undefined) {
                    return;
                }
                if (ss[e.id] !== undefined) {
                    return;
                }
                ss[e.id] = true;
                vv.push(e);
            });
        });
        return vv;
    };
})    

;
